/**
 * 
 */
package com.williamoneil.charts.shared;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * @author Gudipati
 *
 */
@SuppressWarnings("deprecation")
public class PriceVolumeData implements Serializable {

	private static Integer TIMEZONE_OFFSET = null;		
	
	/**
	 * default serial version id
	 */
	private static final long serialVersionUID = 1L;

	private long tradeDate = -1;
	
	private TradeDateType tradeDateType = null;
	
	private BigDecimal open = null;
	private BigDecimal close = null;
	private BigDecimal high = null;
	private BigDecimal low = null;
	
	private BigDecimal adjClose = null;
	
	private long volume = -1;
	
	private BigDecimal splitRatio = null;
	private BigDecimal dividend = null;
	
	/**
	 * @return the tradeDate
	 */
	public long getTradeDate() {
		return tradeDate;
	}

	/**
	 * @param tradeDate the tradeDate to set
	 */
	public void setTradeDate(long tradeDate) {
		this.tradeDate = tradeDate;
	}

	/**
	 * @return the open
	 */
	public BigDecimal getOpen() {
		return open;
	}

	/**
	 * @param open the open to set
	 */
	public void setOpen(BigDecimal open) {
		this.open = open;
	}

	/**
	 * @return the close
	 */
	public BigDecimal getClose() {
		return close;
	}

	/**
	 * @param close the close to set
	 */
	public void setClose(BigDecimal close) {
		this.close = close;
	}

	/**
	 * @return the high
	 */
	public BigDecimal getHigh() {
		return high;
	}

	/**
	 * @param high the high to set
	 */
	public void setHigh(BigDecimal high) {
		this.high = high;
	}

	/**
	 * @return the low
	 */
	public BigDecimal getLow() {
		return low;
	}

	/**
	 * @param low the low to set
	 */
	public void setLow(BigDecimal low) {
		this.low = low;
	}

	/**
	 * @return the volume
	 */
	public long getVolume() {
		return volume;
	}

	/**
	 * @param volume the volume to set
	 */
	public void setVolume(long volume) {
		this.volume = volume;
	}

	/**
	 * @return the adjClose
	 */
	public BigDecimal getAdjClose() {
		return adjClose;
	}

	/**
	 * @param adjClose the adjClose to set
	 */
	public void setAdjClose(BigDecimal adjClose) {
		this.adjClose = adjClose;
	}

	/**
	 * @return the splitRatio
	 */
	public BigDecimal getSplitRatio() {
		return splitRatio;
	}

	/**
	 * @param splitRatio the splitRatio to set
	 */
	public void setSplitRatio(BigDecimal splitRatio) {
		this.splitRatio = splitRatio;
	}

	/**
	 * @return the dividend
	 */
	public BigDecimal getDividend() {
		return dividend;
	}

	/**
	 * @param dividend the dividend to set
	 */
	public void setDividend(BigDecimal dividend) {
		this.dividend = dividend;
	}

	/**
	 * @return the tradeDateType
	 */
	public TradeDateType getTradeDateType() {
		return tradeDateType;
	}

	/**
	 * @param tradeDateType the tradeDateType to set
	 */
	public void setTradeDateType(TradeDateType tradeDateType) {
		this.tradeDateType = tradeDateType;
	}
	
	public Date getTradeDateAsDate() {		
		if(TIMEZONE_OFFSET == null) {
			final Date tempDt = new Date(tradeDate);
			TIMEZONE_OFFSET = tempDt.getTimezoneOffset() * 60 * 1000;
		}
		
		return new Date(tradeDate + TIMEZONE_OFFSET);
	}
}
